@extends('layout.admin.master')
@section('content')
    <div class="card mt-4">
        <div class="card-body">
            <div class="header-body mt--5 mt-md--6">
                <div class="row align-items-center">
                    <div class="col">
                        <!-- Nav -->
                        <ul class="nav nav-tabs nav-overflow header-tabs">
                            <li class="nav-item">
                                <a href="javascript:;" class="nav-link active">
                                    文本回复列表
                                </a>
                            </li>
                            <li class="nav-item">
                                <a href="{{route('wechat.wxReply.create')}}" class="nav-link ">
                                    添加文本回复
                                </a>
                            </li>

                        </ul>

                    </div>
                </div>
            </div>
        </div>
        <div class="card-block">
            <table class="table">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>规则名称</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                @foreach($data as $v)
                <tr>
                    <td scope="row">{{$v->id}}</td>
                    <td>{{$v->rule->name}}</td>
                    <td>
                        <a name="" id="" class="btn btn-outline-info" href="" role="button">推送</a>
                        <a name="" id="" class="btn btn-outline-success" href="{{route('wechat.wxReply.edit',$v)}}">编辑</a>
                        <a name=""  onclick="del(this)" class="btn btn-outline-primary" href="javascript:;" role="button">删除</a>
                        <form action="{{route('wechat.wxReply.destroy',$v)}}" method="post">
                            @csrf @method('DELETE')
                        </form>
                    </td>
                </tr>
                    @endforeach
                </tbody>
            </table>
        </div>
    </div>
    @endsection
@push('js')
    <script>
        function del(obj) {
            $(obj).next('form').submit();
        }
    </script>
@endpush